package mapper;

import com.lqr.javabean.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface UserMapper {
    List<User> selectAllUser();

    @Select("select uid,username uname,password pwd,phone tel from user")
    @ResultMap("u")
    List<User> selectUser1();

    @Select("select * from user")
    @Results(id = "u_r",value = {
            @Result(id = true,column = "uid",property = "uid"),
            @Result(property = "r",column = "uid",one = @One(
                    select="mapper.RoleMapper.selectByUid",
                    fetchType = FetchType.LAZY
            ))
    })
    List<User> selectUser_Role();
}
